import { createRouter, createWebHashHistory } from 'vue-router';

import NormalRouterView from '../views/NormalRouterView.vue';

import LightView from '../views/stock/LightView.vue';
import DIPSplitView from '../views/stock/DIPSplitView.vue';
import StockCheckView from '../views/stock/StockCheckView.vue';
import StockMaintainView from '../views/stock/StockMaintainView.vue';
import StockReturnView from '../views/stock/StockReturnView.vue';
import DIPLightTestView from '../views/stock/DIPLightTestView.vue';

//流水线
import XgRecordView from '../views/lsx/XgRecordView.vue';
import DjRecordView from '../views/lsx/DjRecordView.vue';
import planManagerView from '../views/lsx/PlanManagerView.vue';
import alarmView from '../views/lsx/AlarmView.vue';
import BZRKView from '../views/lsx/BZRKView.vue';

import chuYunView from '../views/cy/ChuYunView.vue';

import ApplySHRecordView from '../views/applySH/ApplySHRecordView.vue';
import ApplySHPrintView from '../views/applySH/ApplySHPrintView.vue';

const routes = [
  //出运
  {
    path: "/cy/chuYun",
    name: "chuYun",
    component: chuYunView,
  },
  //流水线报警
  {
    path: "/lsx/alarm",
    name: "alarm",
    component: alarmView,
  },
  //包装入库记录
  {
    path: "/lsx/bzrk",
    name: "bzrk",
    component: BZRKView,
  },
  //仓库
  {
    path: '/',
    name: 'home',
    component: NormalRouterView,
    redirect: to => {
      // 方法接收目标路由作为参数
      // return 重定向的字符串路径/路径对象
      return { path: '/stock/light', };
    },
  },
  {
    path: "/stock",
    name: "stock",
    component: NormalRouterView,
    meta: {
      routers: [
        {
          link: '/stock/light',
          text: '配盘',
        },
        // {
        //   link: '/stock/DIPSplit',
        //   text: 'DIP扫码出库',
        // },
        {
          link: '/stock/stockMaintain',
          text: '入库上架',
        },
        {
          link: '/stock/stockReturn',
          text: '退料',
        },
        {
          link: '/stock/stockCheck',
          text: '寻找库位',
        },
        {
          link: '/stock/DIPLightTest',
          text: 'DIP测试',
        },
      ],
    },
    children: [
      {
        path: '/stock/light',
        name: 'light',
        component: LightView
      },
      // {
      //   path: '/stock/DIPSplit',
      //   name: 'DIPSplit',
      //   component: DIPSplitView
      // },
      {
        path: '/stock/stockMaintain',
        name: 'stockMaintain',
        component: StockMaintainView
      },
      {
        path: '/stock/stockReturn',
        name: 'stockReturn',
        component: StockReturnView
      },
      {
        path: '/stock/stockCheck',
        name: 'stockCheck',
        component: StockCheckView,
      },
      {
        path: '/stock/DIPLightTest',
        name: 'DIPLightTest',
        component: DIPLightTestView,
      },
    ],
  },
  //流水线
  {
    path: "/lsx",
    name: "lsx",
    component: NormalRouterView,
    meta: {
      routers: [
        {
          link: '/lsx/xgRecord',
          text: '锡膏记录',
        },
        {
          link: '/lsx/djRecord',
          text: '刮刀/钢网换新',
        },
        // {
        //   link: '/outsideApply/spPersonMaintain',
        //   text: '审批人维护',
        // },
      ],
    },
    children: [
      {
        path: "/lsx/xgRecord",
        name: "xgRecord",
        component: XgRecordView,
      },
      {
        path: "/lsx/djRecord",
        name: "djRecord",
        component: DjRecordView,
      },
      // {
      //   path: "/insideApply/spPersonMaintain",
      //   name: "spPersonMaintain",
      //   component: SpPersonMaintain,
      // },
    ],
  },
  //流水线看板
  {
    path: "/lsx/planManager",
    name: "planManager",
    component: planManagerView,
  },

  //领料单损耗记录
  {
    path: "/applySH",
    name: "applySH",
    component: NormalRouterView,
    meta: {
      routers: [
        {
          link: '/applySH/applySHRecord',
          text: '损耗记录',
        },
        // {
        //   link: '/outsideApply/checkCars',
        //   text: '车辆审批',
        // },
        // {
        //   link: '/outsideApply/spPersonMaintain',
        //   text: '审批人维护',
        // },
      ],
    },
    children: [
      {
        path: "/applySH/applySHRecord",
        name: "applySHRecord",
        component: ApplySHRecordView,
      },
      // {
      //   path: "/insideApply/checkCars",
      //   name: "checkCars",
      //   component: CheckCarsView,
      // },
      // {
      //   path: "/insideApply/spPersonMaintain",
      //   name: "spPersonMaintain",
      //   component: SpPersonMaintain,
      // },
    ],
  },
  {
    path: '/applySH/applySHPrint',
    name: 'applySHPrint',
    component: ApplySHPrintView
  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes
});

export default router;
